package _2_factory_method

import "fmt"

type Light interface {
	turnOn();
	turnOff();
}

type BulbLight struct {

}

type TubeLight struct {

}

func (self BulbLight) turnOn(){
	fmt.Println("bulbLight turn on")
}
func (self BulbLight) turnOff(){
	fmt.Println("bulbLight turn off")
}
func (self TubeLight) turnOn(){
	fmt.Println("tubeLight turn on")
}
func (self TubeLight) turnOff(){
	fmt.Println("tubeLight turn off")
}


type Creator interface {
	factory() Light
}

type BulbCreator struct {

}

type TubeCreator struct {

}

func (self *BulbCreator) factory() Light{
	return  &BulbLight{}
}

func (self *TubeCreator) factory() Light{
	return  &TubeLight{}
}

